import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        component: () => import('../views/Manage'),
        redirect: "/home",
        children: [
            {
                path: 'home',
                name: 'Home',
                meta: {title: '首页'},
                component: () => import('../views/Home')
            },
            {
                path: 'user',
                name: 'User',
                meta: {title: '用户管理'},
                component: () => import('../views/User')
            },
            {
                path: 'setting',
                name: 'Setting',
                meta: {title: '系统设置'},
                component: () => import('../views/Setting')
            },
            {
                path: 'network_message',
                name: 'NetworkMessage',
                meta: {title: '网络设置'},
                component: () => import('../views/NetworkMessage')
            },            {
                path: 'system_message',
                name: 'SystemMessage',
                meta: {title: '系统设置'},
                component: () => import('../views/SystemMessage')
            },
            {
                path: 'operating_state',
                name: 'OperatingState',
                meta: {title: '图表分析'},
                component: () => import('../views/OperatingState')
            },
            {
                path: 'person',
                name: 'Person',
                meta: {title: '个人信息'},
                component: () => import('../views/Person')
            },
            {
                path: '/commodity',
                name: 'Commodity',
                meta: {title: '商品信息管理'},
                component: () => import('../views/Commodity')
            },
            {
                path: '/inventory',
                name: 'Inventory',
                meta: {title: '库存管理'},
                component: () => import('../views/Inventory')
            },
            {
                path: '/supplier',
                name: 'Supplier',
                meta: {title: '供应商管理'},
                component: () => import('../views/Supplier')
            },
            {
                path: '/order',
                name: 'Order',
                meta: {title: '销售管理 / 订单管理'},
                component: () => import('../views/Order')
            },
            {
                path: '/map',
                name: 'Map',
                meta: {title: '地图'},
                component: () => import('../views/Map')
            },
            {
                path: '/donate',
                name: 'Donate',
                meta: {title: '关于捐赠'},
                component: () => import('../views/Donate')
            }
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login')
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import('../views/Register')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
